
/**
 * Object that serves as a data storage for vertices within a SimpleGraph.
 * This object is specifically tailored to contain data utilized by Prim's
 * Algorithm.
 * 
 * @author Chris Davidson, Michelle Miller, and Agari Nln
 * @version Winter 2012.
 */
public class PrimVertexData {
	
	/**
	 * The label of the vertex, the current minimum distance to a vertex
	 * in the known set.
	 */
	private Double my_label = Double.MAX_VALUE;
		
	/**
	 * The edge that leads back to the vertex in the known set that
	 * contained the minimum label value.
	 */
	private Edge my_path = null;
	
	/**
	 * Whether this vertex is in the known set or not.
	 */
	private boolean my_known = false;
	
	/**
	 * A reference to the node object associated with this vertex.
	 */
	private final PrimHeapNode my_node;
	
	/**
	 * Constructor.
	 * 
	 * @param the_node The PrimHeapNode associated with the vertex that
	 * 	this object contains data for.
	 */
	public PrimVertexData(final PrimHeapNode the_node) {
		my_node = the_node;
	}
	
	/**
	 * Resets the current label value to the provided label value and,
	 * the current path to the provided edge.
	 * 
	 * @param the_label The label to set as the new label.
	 * @param the_edge The edge to set as the new path.
	 */
	public void update(final Double the_label, final Edge the_edge) {
		my_label = the_label;
		my_path = the_edge;
	}
	
	/**
	 * Returns the edge associated with the current label value.
	 * 
	 * @return The edge associated with the current label value.
	 */
	public Edge getPath() {
		return my_path;
	}
	
	/**
	 * Returns the current label value.
	 * 
	 * @return The current label value.
	 */
	public Double getLabel() {
		return my_label;
	}
	
	/**
	 * Sets the vertex as being in the known set.
	 */
	public void setKnown() {
		my_known = true;
	}
	
	/**
	 * Returns whether or not the current vertex is in the known set or not.
	 * 
	 * @return The value of my_known.
	 */
	public boolean isKnown() {
		return my_known;
	}

	/**
	 * Returns a reference to the PrimHeapNode object associated with this
	 * vertex.
	 * 
	 * @return A reference to the PrimHeapNode object associated with this
	 * 	vertex.
	 */
	public PrimHeapNode getNode() {
		return my_node;
	}
}
